import java.io.PrintWriter;
import java.util.ArrayList;


public class Output {
	PrintWriter out;
	
	Output() {
		out = new PrintWriter(System.out);
	}
	
	void writeInit(Field f) {
		int n = f.towers.length;
		out.printf("%d\n", n);
		for (int i = 0; i < n; i++) {
			out.printf("%d%c", f.towers[i].type, (i == n - 1 ? ' ' : '\n'));
		}
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				out.printf("%d%c", f.towers[i].getDist(f.towers[j]), (i == n - 1 ? ' ' : '\n'));
			}
		}
	}
	
	void writeStep(Field f) {
		writeTowers(f.towers);
		writeSoldiers(f.soldiers);
	}
	
	void writeTowers(Tower[] towers) {
		int n = towers.length;
		for (int i = 0; i < n; i++) {
			out.print(towers[i].type);
			for (int j = 0; j < towers[i].peopleCount.length; j++)
				out.print(towers[i].peopleCount[j]);
			out.print(towers[i].level);
			out.println(towers[i].leftUpgrade);
		}
	}
	
	
	void writeSoldiers(ArrayList<Soldier> soldiers) {
		int n = soldiers.size();
		out.println(n);
		for (int i = 0; i < n; i++) {
			Soldier soldier = soldiers.get(i);
			out.print(soldier.peopleCount);
			out.print(soldier.destination.id);
			out.print(soldier.leftTime);
			out.println(soldier.type);
		}
	}
}
